import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { CommonButton } from '../Common/options'
import { OrganizationIdentityLevel, ProjectRegionTree } from '../Common/Conversion'

export const ProjectFileMenuModal = async ({ url, OptionsEvent, Permission }) => {
    let data = {
        type: 'PPP模式',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`getProjectCompanyInfosOC`],
        added: `posProjectCompanyInfos`,
        modify: `putProjectCompanyInfos`,
        delete: `delProjectCompanyInfos`,
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'organizationUuid',
                title: '组织机构',
                valueType: 'select',
                valueEnum: await OrganizationIdentityLevel(3),
                ellipsis: true,
                width: 300,
                rules: true,
            },
            {
                dataIndex: 'responsiblePerson',
                title: '负责人',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 150,
            },
            {
                dataIndex: 'municipalProjectCount',
                title: '市政项目个数',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 150,
            },

            {
                dataIndex: 'roadProjectCount',
                title: '公路项目个数',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 150,
            },
            {
                dataIndex: 'houseProjectCount',
                title: '房建项目个数',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 150,
            },
            {
                dataIndex: 'projectRegionUuid',
                title: '合作区县',
                valueType: 'treeSelect',
                hideInSearch: true,
                ellipsis: true,
                fieldProps: {
                    options: await ProjectRegionTree(),
                    fieldNames: { label: 'tableName', value: 'uuid' },
                },
                width: 150,
            },
            {
                dataIndex: 'buildDuration',
                title: '建设期限',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'projectName',
                title: '项目名称',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 250,
            },

            {
                dataIndex: 'staffing',
                title: '人员配置',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'startDate',
                title: '开始日期',
                valueType: 'Date',
                hideInSearch: true,
                ellipsis: true,
                showTime: true,
                width: 150,
            },
            {
                dataIndex: 'projectType',
                title: '项目类型',
                valueType: 'select',
                hideInSearch: true,
                ellipsis: true,
                valueEnum: BuiltInData.projectType,
                width: 150,
            },
            {
                dataIndex: 'currentPeriod',
                title: '项目阶段',
                valueType: 'select',
                hideInSearch: true,
                ellipsis: true,
                valueEnum: BuiltInData.CurrentPeriod,
                width: 150,
            },
            {
                dataIndex: 'totalInvestment',
                title: '总投资(万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'constructionInvestment',
                title: '建设投资(万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'constructionFees',
                title: '建安费(万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'capitalAmount',
                title: '资本金总额(万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'capitalPercent',
                title: '资本金占比(%)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'socialProjectCapitalRatio',
                title: '社会资本方资本金与项目资本金占比(%)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 280,
            },
            {
                dataIndex: 'badaShouldCapitalAmount',
                title: '八达路桥公司资本金情况(应投 万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 240,
            },
            {
                dataIndex: 'badaCompletedCapitalAmount',
                title: '八达路桥公司资本金情况(已投 万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 240,
            },
            {
                dataIndex: 'totalCompletedInvestment',
                title: '累计完成总投资(万元)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 240,
            },
            {
                dataIndex: 'earningRatio',
                title: '财务内部收益率(%)',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'cooperationDuration',
                title: '合作期限（建+养）',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'projectOverview',
                title: '项目概况',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 400,
            },
            {
                dataIndex: 'projectCompanyCoordinate',
                title: '坐标',
                valueType: 'input',
                ellipsis: true,
                width: 150,
                hideInAdded: true,
                hideInModify: true,
                hideInSearch: true,
                hideInTable: true,
            },
            { ...commonTableList.code, rules: true },
            { ...commonTableList.sortId, rules: true },
            { ...commonTableList.isEnabled, rules: true },
            // commonTableList.remark,
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    // const { uuid } = record
                    return [
                        <CommonButton
                            key="one"
                            OptionsEvent={OptionsEvent}
                            title="附件管理"
                            data={{
                                smallTitle: `PPP管理附件详情`,
                                type: 'BaDaFilingCabinet',
                                record,
                                width: 1500,
                                Permission,
                                dataType: 0,
                            }}
                        />,
                        <CommonButton
                            key="two"
                            OptionsEvent={OptionsEvent}
                            title="文件配置"
                            data={{
                                smallTitle: `PPP建设模式管理程序文件配置`,
                                type: 'BaDaFilingCabinetConfiguration',
                                record,
                                width: 1500,
                                dataType: 0,
                            }}
                        />,

                        // <TwoModalBtn
                        //     key="TwoModalPPP"
                        //     towKey="ProjectCompanyInfos"
                        //     OptionsEvent={OptionsEvent}
                        //     data={record}
                        //     Permission={Permission}
                        //     title="PPP管理附件"
                        // />,
                        // Permission.findIndex(v => v.uuid === '5c9e2c53-9fc9-4082-88db-33eb0bda8455') !== -1 && (
                        //     <OtherBtn
                        //         key="more"
                        //         OptionsEvent={OptionsEvent}
                        //         record={record}
                        //         pageHeaderData={data.columns}
                        //         menus={[
                        //             {
                        //                 key: 'ProjectFileMenuModal',
                        //                 name: 'PPP建设模式管理程序文件配置',
                        //                 list: [
                        //                     'getPPPListTree',
                        //                     'getOrganizationPppList',
                        //                     'posOrganizationPppListBatch',
                        //                     'pppListUuid',
                        //                 ],
                        //             },
                        //         ]}
                        //     />
                        // ),
                    ]
                },
            },
        ],
    }
    return data
}
